/*
 * MyJFrame.java
 *
 * Created on May 18, 2006, 6:26 PM
 */

/**
 *
 * @author  iman
 */
import java.awt.*;
import java.lang.System.*;
import java.io.File.*;
import javax.swing.*;
import java.io.*;


public class MyButtonWizardFrame extends javax.swing.JFrame {
    public int index1,index2,flagNext=0;
    public byte operation,category;
     private MyFrame mainFrame;
    public  MyButtonWizardPanel1 c=new MyButtonWizardPanel1(this);;
    //public  Mypanel2 c;
    /** Creates new form MyJFrame */
    public MyButtonWizardFrame(MyFrame frame) {
        initComponents();
        this.mainFrame = frame;
        setLayout(new FlowLayout());setVisible(true);
        jList1.setSelectedIndex(0);
        jList2.setSelectedIndex(0);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList2 = new javax.swing.JList();
        jSeparator1 = new javax.swing.JSeparator();
        jPanel2 = new javax.swing.JPanel();
        jButton5 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        jLabel1.setText("What Action do you want to happen when button is pressed ?");

        jLabel2.setText("Diffrent actions are available for each category:");

        jButton1.setText("Cancel");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("< Back");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("Next >");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Finish");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel3.setText("Categories:");

        jLabel4.setText("Actions:");

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Record Navigation", "Record Operations", "Form Operations" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList1ValueChanged(evt);
            }
        });

        jScrollPane1.setViewportView(jList1);

        jList2.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Find Record", "Go To First Record", "Go To Last Record", "Go To Next Record", "Go To Previous Record" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList2.setAutoscrolls(false);
        jList2.setFocusable(false);
        jList2.setSelectionModel(jList2.getSelectionModel());
        jList2.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList2ValueChanged(evt);
            }
        });

        jScrollPane2.setViewportView(jList2);

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 65, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jPanel1Layout.createSequentialGroup()
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 141, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                                .add(79, 79, 79)
                                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 145, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 56, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(79, 79, 79))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                                .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 90, Short.MAX_VALUE)
                                .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)
                            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 295, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE)
                        .add(31, 31, 31))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .add(19, 19, 19)
                .add(jLabel2)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(jLabel4))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jButton5.setText("Find Next");

        jLabel5.setText("Sample:");

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jButton5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE))
                    .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 59, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jLabel5)
                .add(17, 17, 17)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jButton5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 207, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(56, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 20, Short.MAX_VALUE)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
   
    private void jList2ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList2ValueChanged
        index2=jList2.getSelectedIndex();// TODO add your handling code here:
         jButton5.setText((String)jList2.getSelectedValue());
         operation=(byte)(index2+1);
    }//GEN-LAST:event_jList2ValueChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
         // TODO add your handling code here:
       
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
         
          flagNext=1;
          //c=new Mypanel2();
          String[] S0={(String)jList2.getSelectedValue()};
          String[] S1={(String)jList2.getSelectedValue()};
          String[] S2={(String)jList2.getSelectedValue()};
          String[] S3={(String)jList2.getSelectedValue()};
          String[] S4={(String)jList2.getSelectedValue()};
          String[] S5={(String)jList2.getSelectedValue()};
          String[] S6={(String)jList2.getSelectedValue()};
          String[] S7={(String)jList2.getSelectedValue()};
          String[] S8={(String)jList2.getSelectedValue()};
          String[] S9={(String)jList2.getSelectedValue()};
          String[] S10={(String)jList2.getSelectedValue()};
          String[] S11={(String)jList2.getSelectedValue()};
          String[] S12={(String)jList2.getSelectedValue()};
          String[] S13={(String)jList2.getSelectedValue()};
          String[] S14={(String)jList2.getSelectedValue()};
          String[] S15={(String)jList2.getSelectedValue()};
          String[] S16={(String)jList2.getSelectedValue()};
          String[] S17={(String)jList2.getSelectedValue()};
        //c=new Mypanel2(this);
          if (index1==0)
          { 
              category=01;
             switch (index2)
              {  case 0:  remove (jPanel1);
                          remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S1);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          System.out.println(c.choice);
                          operation=1;
                          break;
                         
                  case 1:  remove (jPanel1);
                           remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S2);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                           System.out.println(c.choice);
                           operation=2;
                          break;
                  case 2:  remove (jPanel1);
                              remove (jPanel2);
                           add (c);
                          c.jList1.setListData(S3);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                           System.out.println(c.choice);
                          operation=3;
                           break;
                  case 3:  remove (jPanel1);
                            remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S4);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=4;
                          break;
                 case 4:  remove (jPanel1);
                  remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S5);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                           System.out.println(c.choice);
                          operation=5;
                          break;
                case 5:  remove (jPanel1);
                 remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S6);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=6;
                           break;
                           
                           
              }
             
              validate();
               repaint();// TODO add your handling code here:
                
              if(c.flagBack==1){ 
                     if(c.image==1) {c.button=new JButton(new ImageIcon());
                                c.button.setIcon(new ImageIcon("C://Documents and Settings//iman//Desktop//MySQLFormBuilder//Images//Cut.png"));}
                     else {c.button=new JButton(c.choice);}
               } 
               else  {c.button=new JButton(c.choice);}
               
                c.button.setSize(168, 80);
                c.button.setLocation(480,50);
                c.add(c.button);
                c.validate();
                c.repaint();
                System.out.println("back=......."+c.flagBack);
                System.out.println("image=......."+c.image);
          }
          
           if (index1==1)
          { 
             category=02; 
             switch (index2)
              {  case 0:  remove (jPanel1);
                          remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S7);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=7;
                           break;
                  case 1:  remove (jPanel1);
                           remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S8);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=8;
                          break;
                  case 2:  remove (jPanel1);
                           remove (jPanel2);
                           add (c);
                          c.jList1.setListData(S9);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=9;
                           break;
                  case 3:  remove (jPanel1);
                            remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S10);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=10;
                           break;
                 case 4:  remove (jPanel1);
                           remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S11);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=11;
                           break;
                case 5:  remove (jPanel1);
                          remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S12);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=12;
                           break;
                           
              }
             
              validate();
               repaint();// TODO add your handling code here:
                  
               if(c.flagBack==1){ 
                     if(c.image==1) {c.button=new JButton(new ImageIcon());
                                c.button.setIcon(new ImageIcon("C://Documents and Settings//iman//Desktop//MySQLFormBuilder//Images//Cut.png"));}
                     else {c.button=new JButton(c.choice);}
               } 
               else  {c.button=new JButton(c.choice);}
                c.button.setSize(168, 80);
                c.button.setLocation(480,50);
                c.add(c.button);
                c.validate();
                c.repaint();
                 System.out.println("back=......."+c.flagBack);
                 System.out.println("image=......."+c.image);
          }
          
        if (index1==2)
          { 
             category=03; 
             switch (index2)
              {  case 0:  remove (jPanel1);
                           remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S13);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=13;
                           break;
                  case 1:  remove (jPanel1);
                            remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S14);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=14;
                          break;
                  case 2:  remove (jPanel1);
                            remove (jPanel2);
                           add (c);
                          c.jList1.setListData(S15);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=15;
                          break;
                  case 3:  remove (jPanel1);
                            remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S16);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=16;
                           break;
                 case 4:  remove (jPanel1);
                          remove (jPanel2);
                          add (c);
                          c.jList1.setListData(S17);
                          c.jTextField1.setText((String)jList2.getSelectedValue());
                          c.choice=(String)jList2.getSelectedValue();
                          operation=17;
                           break;
              
                           
              }
             
              validate();
               repaint();// TODO add your handling code here:
             
               if(c.flagBack==1){ 
                     if(c.image==1) {c.button=new JButton(new ImageIcon());
                                c.button.setIcon(new ImageIcon("C://Documents and Settings//iman//Desktop//MySQLFormBuilder//Images//Cut.png"));}
                     else {c.button=new JButton(c.choice);}
               } 
               else  {c.button=new JButton(c.choice);}
                c.button.setSize(168, 80);
                c.button.setLocation(480,50);
                c.add(c.button);
                c.validate();
                c.repaint();
                 System.out.println("back=......."+c.flagBack);
                  System.out.println("image=......."+c.image);
               
          }
         
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
              finish(null, null);       
              this.dispose();       
              // TODO add your handling code here:
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        
        this.dispose();// TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
        index1=jList1.getSelectedIndex();
        String[] S1={"Find Next","Find Record","Go To First Record","Go To Last Record","Go To Next Record","Go To Previous Record"};
        String[] S2={"Add New Record","Delete Record","Duplicate Record","Print Record","Save Record","Undo Record"};
        String[] S3={"Apply Form Filter","Close Form","Open Form","Print Form","Refresh Form Data"};
        // TODO add your handling code here:
        if(index1==0){jList2.setListData(S1);}
        if(index1==1){jList2.setListData(S2);}
        if(index1==2){jList2.setListData(S3);}
        // TODO add your handling code here:
    }//GEN-LAST:event_jList1ValueChanged
    
    /**
     * @param args the command line arguments
     */
   /* public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MyJFrame().setVisible(true);
            }
        });
    }*/
     public void finish(String tname, ImageIcon i) {
        //MyFrame mainFrame = frame.getMainFrame();
        //System.out.println("The name is "+p2.tname);
        MyButtonContainer button;
        mainFrame.incCount(MyToolBox.BUTTON);
        if(tname != null) {
            button=new MyButtonContainer(tname, mainFrame);
        } else if(i != null) {
            button=new MyButtonContainer(i, mainFrame);
        } else {
            button=new MyButtonContainer("button"+mainFrame.getCount(MyToolBox.BUTTON), mainFrame);
        }
        //System.out.println(mainFrame.getDragWidth()+mainFrame.getDragHeight()+mainFrame.getX1()+mainFrame.getY1());
        button.getComponent().setSize(mainFrame.getDragWidth(), mainFrame.getDragHeight());
        button.getComponent().setLocation(mainFrame.getX1(),mainFrame.getY1());
        
        button.getComponent().setName("button"+mainFrame.getCount(MyToolBox.BUTTON)); 
        mainFrame.getPanel().add(button.getComponent());
        mainFrame.componentList.add(button);                              
        button.operation=operation;
        //button.category=category;
        //System.out.println("Operation is ..........."+button.operation);
        //System.out.println("Category is ..........."+button.category);   
        mainFrame.getPanel().repaint();
        dispose();        
    }  
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JList jList1;
    private javax.swing.JList jList2;
    public javax.swing.JPanel jPanel1;
    public javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    // End of variables declaration//GEN-END:variables
    
}
